/**
 * @author: Niimp
 * @date: 2023/12/13 16:31
 * @statement:
 */
package com.dmgis.hndz.service.serviceUtils;

import com.dmgis.hndz.pojo.*;
import com.dmgis.hndz.pojoVo.*;
import org.springframework.stereotype.Component;

import java.util.*;
import java.util.stream.Collectors;

/**
 * MonitoringManagementService辅助方法
 */
@Component
public class MonitoringManagementUtils {

    /**
     * 位移日统计辅助方法
     *
     * @param listX
     * @param monitorCode
     * @return
     */
    public static List<DetectionCurveVo> getDetectionCurveDayMethod(List<DetectionCurveVo> listX, String monitorCode) {
        // 日期格式化只保留年月日
        listX = listX.stream()
                .map(dc -> {
                    dc.setDateTime(dc.getDateTime().substring(0, 10));
                    return dc;
                })
                .collect(Collectors.toList());
        // 根据SensorCode和DateTime进行分组并对Displacement求平均值
//        Map<String, Map<String, Double>> displacementAvgMap = listX.stream()
//                .collect(
//                        Collectors.groupingBy(DetectionCurveVo::getSensorCode,
//                                Collectors.groupingBy(dc -> dc.getDateTime().substring(0, 10),
//                                        Collectors.averagingDouble(dc -> Double.parseDouble(dc.getDisplacement())))));
        Map<String, Map<String, Double>> displacementAvgMap = listX.stream()
                .collect(
                        Collectors.groupingBy(DetectionCurveVo::getSensorCode,
                                Collectors.toMap(dc -> dc.getDateTime().substring(0, 10),
                                        dc -> Double.parseDouble(dc.getDisplacement()),
                                        (oldValue, newValue) -> oldValue,
                                        LinkedHashMap::new)
                        )
                );

        // 将Map<String, Map<String, Double>> displacementAvgMap转化为List<DetectionCurveVo>
        // key -> sensorCode, value map key -> dateTime,value map value -> displacement
        List<DetectionCurveVo> resultX = new ArrayList<>();
        displacementAvgMap.forEach((sensorCode, timeDisplacementMap) -> {
            timeDisplacementMap.forEach((time, displacement) -> {
                DetectionCurveVo detectionCurveVo = new DetectionCurveVo();
                detectionCurveVo.setMonitorCode(monitorCode);
                detectionCurveVo.setSensorCode(sensorCode);
                detectionCurveVo.setDateTime(time);
                detectionCurveVo.setDisplacement(displacement.toString());
                resultX.add(detectionCurveVo);
            });
        });
        return resultX;
    }


    /**
     * 位移月统计辅助方法
     *
     * @param listX
     * @param monitorCode
     * @return
     */
    public static List<DetectionCurveVo> getDetectionCurveMonthMethod(List<DetectionCurveVo> listX, String monitorCode) {
        listX = listX.stream()
                .map(dc -> {
                    dc.setDateTime(dc.getDateTime().substring(0, 7));
                    return dc;
                })
                .collect(Collectors.toList());
//        Map<String, Map<String, Double>> displacementAvgMap = listX.stream()
//                .collect(
//                        Collectors.groupingBy(DetectionCurveVo::getSensorCode,
//                                Collectors.groupingBy(dc -> dc.getDateTime().substring(0, 7),
//                                        Collectors.averagingDouble(dc -> Double.parseDouble(dc.getDisplacement())))));
        Map<String, Map<String, Double>> displacementAvgMap = listX.stream()
                .collect(
                        Collectors.groupingBy(DetectionCurveVo::getSensorCode,
                                Collectors.toMap(dc -> dc.getDateTime().substring(0, 7),
                                        dc -> Double.parseDouble(dc.getDisplacement()),
                                        (oldValue, newValue) -> oldValue,
                                        LinkedHashMap::new)
                        )
                );


        List<DetectionCurveVo> resultX = new ArrayList<>();
        displacementAvgMap.forEach((sensorCode, timeDisplacementMap) -> {
            timeDisplacementMap.forEach((time, displacement) -> {
                DetectionCurveVo detectionCurveVo = new DetectionCurveVo();
                detectionCurveVo.setMonitorCode(monitorCode);
                detectionCurveVo.setSensorCode(sensorCode);
                detectionCurveVo.setDateTime(time);
                detectionCurveVo.setDisplacement(displacement.toString());
                resultX.add(detectionCurveVo);
            });
        });
        return resultX;
    }


    /**
     * 加速度日统计辅助方法
     *
     * @param listX
     * @param monitorCode
     * @return
     */
    public static List<DetectionCurveAccelerationVo> getDetectionCurveAccelerationDayMethod(List<DetectionCurveAccelerationVo> listX, String monitorCode) {
        // 日期格式化只保留年月日
        listX = listX.stream()
                .map(dc -> {
                    dc.setDateTime(dc.getDateTime().substring(0, 10));
                    return dc;
                })
                .collect(Collectors.toList());
        // 根据SensorCode和DateTime进行分组并对Acceleration求平均值
//        Map<String, Map<String, Double>> accelerationAvgMap = listX.stream()
//                .collect(
//                        Collectors.groupingBy(DetectionCurveAccelerationVo::getSensorCode,
//                                Collectors.groupingBy(dc -> dc.getDateTime().substring(0, 10),
//                                        Collectors.averagingDouble(dc -> Double.parseDouble(dc.getAcceleration())))));
        Map<String, Map<String, Double>> accelerationAvgMap = listX.stream()
                .collect(
                        Collectors.groupingBy(DetectionCurveAccelerationVo::getSensorCode,
                                Collectors.toMap(dc -> dc.getDateTime().substring(0, 10),
                                        dc -> Double.parseDouble(dc.getAcceleration()),
                                        (oldValue, newValue) -> oldValue,
                                        LinkedHashMap::new)
                        )
                );

        // 将Map<String, Map<String, Double>> accelerationAvgMap转化为List<DetectionCurveVo>
        // key -> sensorCode, value map key -> dateTime,value map value -> acceleration
        List<DetectionCurveAccelerationVo> resultX = new ArrayList<>();
        accelerationAvgMap.forEach((sensorCode, timeAccelerationMap) -> {
            timeAccelerationMap.forEach((time, acceleration) -> {
                DetectionCurveAccelerationVo detectionCurveVo = new DetectionCurveAccelerationVo();
                detectionCurveVo.setMonitorCode(monitorCode);
                detectionCurveVo.setSensorCode(sensorCode);
                detectionCurveVo.setDateTime(time);
                detectionCurveVo.setAcceleration(acceleration.toString());
                resultX.add(detectionCurveVo);
            });
        });
        return resultX;
    }


    /**
     * 加速度月统计辅助方法
     *
     * @param listX
     * @param monitorCode
     * @return
     */
    public static List<DetectionCurveAccelerationVo> getDetectionCurveAccelerationMonthMonth(List<DetectionCurveAccelerationVo> listX, String monitorCode) {
        // 日期格式化只保留年月日
        listX = listX.stream()
                .map(dc -> {
                    dc.setDateTime(dc.getDateTime().substring(0, 7));
                    return dc;
                })
                .collect(Collectors.toList());
        // 根据SensorCode和DateTime进行分组并对Acceleration求平均值
//        Map<String, Map<String, Double>> accelerationAvgMap = listX.stream()
//                .collect(
//                        Collectors.groupingBy(DetectionCurveAccelerationVo::getSensorCode,
//                                Collectors.groupingBy(dc -> dc.getDateTime().substring(0, 7),
//                                        Collectors.averagingDouble(dc -> Double.parseDouble(dc.getAcceleration())))));
        Map<String, Map<String, Double>> accelerationAvgMap = listX.stream()
                .collect(
                        Collectors.groupingBy(DetectionCurveAccelerationVo::getSensorCode,
                                Collectors.toMap(dc -> dc.getDateTime().substring(0, 7),
                                        dc -> Double.parseDouble(dc.getAcceleration()),
                                        (oldValue, newValue) -> oldValue,
                                        LinkedHashMap::new)
                        )
                );



        // 将Map<String, Map<String, Double>> accelerationAvgMap转化为List<DetectionCurveVo>
        // key -> sensorCode, value map key -> dateTime,value map value -> acceleration
        List<DetectionCurveAccelerationVo> resultX = new ArrayList<>();
        accelerationAvgMap.forEach((sensorCode, timeAccelerationMap) -> {
            timeAccelerationMap.forEach((time, acceleration) -> {
                DetectionCurveAccelerationVo detectionCurveVo = new DetectionCurveAccelerationVo();
                detectionCurveVo.setMonitorCode(monitorCode);
                detectionCurveVo.setSensorCode(sensorCode);
                detectionCurveVo.setDateTime(time);
                detectionCurveVo.setAcceleration(acceleration.toString());
                resultX.add(detectionCurveVo);
            });
        });
        return resultX;
    }


    /**
     * 倾角日统计辅助方法
     *
     * @param listX
     * @param monitorCode
     * @return
     */
    public static List<DetectionCurveDipAngleVo> getDetectionCurveDipAngleDayMethod(List<DetectionCurveDipAngleVo> listX, String monitorCode) {
        // 日期格式化只保留年月日
        listX = listX.stream()
                .map(dc -> {
                    dc.setDateTime(dc.getDateTime().substring(0, 10));
                    return dc;
                })
                .collect(Collectors.toList());
        // 根据SensorCode和DateTime进行分组并对DipAngle求平均值
//        Map<String, Map<String, Double>> dipAngleAvgMap = listX.stream()
//                .collect(
//                        Collectors.groupingBy(DetectionCurveDipAngleVo::getSensorCode,
//                                Collectors.groupingBy(dc -> dc.getDateTime().substring(0, 10),
//                                        Collectors.averagingDouble(dc -> Double.parseDouble(dc.getDipAngle())))));
        Map<String, Map<String, Double>> dipAngleAvgMap = listX.stream()
                .collect(
                        Collectors.groupingBy(DetectionCurveDipAngleVo::getSensorCode,
                                Collectors.toMap(dc -> dc.getDateTime().substring(0, 10),
                                        dc -> Double.parseDouble(dc.getDipAngle()),
                                        (oldValue, newValue) -> oldValue,
                                        LinkedHashMap::new)
                        )
                );

        // 将Map<String, Map<String, Double>> dipAngleAvgMap转化为List<DetectionCurveVo>
        // key -> sensorCode, value map key -> dateTime,value map value -> dipAngle
        List<DetectionCurveDipAngleVo> resultX = new ArrayList<>();
        dipAngleAvgMap.forEach((sensorCode, timeDipAngleMap) -> {
            timeDipAngleMap.forEach((time, dipAngle) -> {
                DetectionCurveDipAngleVo detectionCurveVo = new DetectionCurveDipAngleVo();
                detectionCurveVo.setMonitorCode(monitorCode);
                detectionCurveVo.setSensorCode(sensorCode);
                detectionCurveVo.setDateTime(time);
                detectionCurveVo.setDipAngle(dipAngle.toString());
                resultX.add(detectionCurveVo);
            });
        });
        return resultX;
    }


    /**
     * 倾角月统计辅助方法
     *
     * @param listX
     * @param monitorCode
     * @return
     */
    public static List<DetectionCurveDipAngleVo> getDetectionCurveDipAngleMonthMethod(List<DetectionCurveDipAngleVo> listX, String monitorCode) {
        // 日期格式化只保留年月
        listX = listX.stream()
                .map(dc -> {
                    dc.setDateTime(dc.getDateTime().substring(0, 7));
                    return dc;
                })
                .collect(Collectors.toList());
        // 根据SensorCode和DateTime进行分组并对Acceleration求平均值
//        Map<String, Map<String, Double>> accelerationAvgMap = listX.stream()
//                .collect(
//                        Collectors.groupingBy(DetectionCurveDipAngleVo::getSensorCode,
//                                Collectors.groupingBy(dc -> dc.getDateTime().substring(0, 7),
//                                        Collectors.averagingDouble(dc -> Double.parseDouble(dc.getDipAngle())))));
        Map<String, Map<String, Double>> dipAngleAvgMap = listX.stream()
                .collect(
                        Collectors.groupingBy(DetectionCurveDipAngleVo::getSensorCode,
                                Collectors.toMap(dc -> dc.getDateTime().substring(0, 7),
                                        dc -> Double.parseDouble(dc.getDipAngle()),
                                        (oldValue, newValue) -> oldValue,
                                        LinkedHashMap::new)
                        )
                );

        // 将Map<String, Map<String, Double>> accelerationAvgMap转化为List<DetectionCurveVo>
        // key -> sensorCode, value map key -> dateTime,value map value -> acceleration
        List<DetectionCurveDipAngleVo> resultX = new ArrayList<>();
        dipAngleAvgMap.forEach((sensorCode, timeAccelerationMap) -> {
            timeAccelerationMap.forEach((time, acceleration) -> {
                DetectionCurveDipAngleVo detectionCurveVo = new DetectionCurveDipAngleVo();
                detectionCurveVo.setMonitorCode(monitorCode);
                detectionCurveVo.setSensorCode(sensorCode);
                detectionCurveVo.setDateTime(time);
                detectionCurveVo.setDipAngle(acceleration.toString());
                resultX.add(detectionCurveVo);
            });
        });
        return resultX;
    }


    /**
     * 雨量天统计辅助方法
     *
     * @param listX
     * @return
     */
    public static List<DetectionCurveRainfallVo> getDetectionCurveRainfallDayMethod(List<DetectionCurveRainfallVo> listX) {
        listX = listX.stream()
                .filter(r -> "07".equals(r.getDateTime().substring(11, 13)))
                .collect(Collectors.toList());
        listX = listX.stream()
                .map(
                        r -> {
                            r.setDateTime(r.getDateTime().substring(0, 10));
                            return r;
                        }
                ).collect(Collectors.toList());

        return listX;

    }


    /**
     * 雨量月统计辅助方法
     *
     * @param listX
     * @return
     */
    public static List<DetectionCurveRainfallVo> getDetectionCurveRainfallMonthMethod(List<DetectionCurveRainfallVo> listX, String monitorCode) {


        listX = listX.stream()
                .filter(r -> "07:00:02".equals(r.getDateTime().substring(11)))
                .collect(Collectors.toList());
        listX = listX.stream()
                .map(
                        r -> {
                            r.setDateTime(r.getDateTime().substring(0, 7));
                            return r;
                        }
                ).collect(Collectors.toList());
//        Map<String, Map<String, Double>> rainfallSumMap = listX.stream()
//                .collect(
//                        Collectors.groupingBy(DetectionCurveRainfallVo::getSensorCode,
//                                Collectors.groupingBy(r -> r.getDateTime().substring(0, 7),
//                                        Collectors.summingDouble(r -> Double.parseDouble(r.getRainfall())))));
        Map<String, Map<String, Double>> rainfallSumMap = listX.stream()
                .collect(
                        Collectors.groupingBy(DetectionCurveRainfallVo::getSensorCode,
                                Collectors.toMap(dc -> dc.getDateTime().substring(0, 7),
                                        dc -> Double.parseDouble(dc.getRainfall()),
                                        (oldValue, newValue) -> oldValue,
                                        LinkedHashMap::new)
                        )
                );

        List<DetectionCurveRainfallVo> resultX = new ArrayList<>();
        rainfallSumMap.forEach((sensorCode, timeAccelerationMap) -> {
            timeAccelerationMap.forEach((time, acceleration) -> {
                DetectionCurveRainfallVo detectionCurveVo = new DetectionCurveRainfallVo();
                detectionCurveVo.setMonitorCode(monitorCode);
                detectionCurveVo.setSensorCode(sensorCode);
                detectionCurveVo.setDateTime(time);
                detectionCurveVo.setRainfall(acceleration.toString());
                resultX.add(detectionCurveVo);
            });
        });
        return resultX;

    }

    /**
     * 雨量辅助方法-累加值
     *
     * @param rainfallSumDayList
     * @return
     */
    public static List<DetectionCurveRainfallVo> getDetectionCurveRainfallRunningTotalMethod(List<DetectionCurveRainfallVo> rainfallSumDayList) {
        for (int i = 0; i < rainfallSumDayList.size() - 1; i++) {
            rainfallSumDayList.set(i + 1, new DetectionCurveRainfallVo(rainfallSumDayList.get(i + 1).getDateTime(),
                    rainfallSumDayList.get(i + 1).getMonitorCode(),
                    rainfallSumDayList.get(i + 1).getSensorCode(),
                    String.valueOf(Double.parseDouble(rainfallSumDayList.get(i).getRainfall())
                            + Double.parseDouble(rainfallSumDayList.get(i + 1).getRainfall()))
            ));
        }
        return rainfallSumDayList;
    }


    /**
     * 气温辅助方法-累加值
     * @param runningList
     * @return
     */
    public static List<Jcaa12a> getDetectionCurveAirTemperatureRunningTotalMethod(List<Jcaa12a> runningList) {
        for (int i = 0; i < runningList.size() - 1; i++) {
            runningList.set(i + 1, new Jcaa12a(runningList.get(i + 1).getJcca31b030(),
                    runningList.get(i + 1).getJcca31b180(),
                    runningList.get(i + 1).getJcaa12a040(),
                    String.valueOf(Double.parseDouble(runningList.get(i).getJcaa12a050())
                            + Double.parseDouble(runningList.get(i + 1).getJcaa12a050()))
            ));
        }
        return runningList;
    }


    /**
     * 气温日统计辅助方法
     * @param list
     * @param monitorCode
     * @return
     */
    public static List<Jcaa12a> getDetectionCurveAirTemperatureDayMethod(List<Jcaa12a> list,String monitorCode) {
        // 日期格式化只保留年月日
        list = list.stream()
                .map(dc -> {
                    dc.setJcaa12a040(dc.getJcaa12a040().substring(0, 10));
                    return dc;
                })
                .collect(Collectors.toList());
        // 根据SensorCode和DateTime进行分组并对AirTemperature求平均值并按照时间升序排列
//        Map<String, Map<String, Double>> airTemperatureAvgMap = list.stream()
//                .collect(
//                        Collectors.groupingBy(Jcaa12a::getJcca31b180,
//                                Collectors.groupingBy(dc -> dc.getJcaa12a040().substring(0, 10),
//                                        Collectors.averagingDouble(dc -> Double.parseDouble(dc.getJcaa12a050())))));

        Map<String, Map<String, Double>> airTemperatureAvgMap = list.stream()
                .collect(
                        Collectors.groupingBy(Jcaa12a::getJcca31b180,
                                Collectors.toMap(dc -> dc.getJcaa12a040().substring(0, 10),
                                        dc -> Double.parseDouble(dc.getJcaa12a050()),
                                        (oldValue, newValue) -> oldValue,
                                        LinkedHashMap::new)
                        )
                );

        // 将Map<String, Map<String, Double>> dipAngleAvgMap转化为List<DetectionCurveVo>
        // key -> sensorCode, value map key -> dateTime,value map value -> dipAngle
        List<Jcaa12a> resultX = new ArrayList<>();
        airTemperatureAvgMap.forEach((sensorCode, timeDipAngleMap) -> {
            timeDipAngleMap.forEach((time, dipAngle) -> {
                Jcaa12a jcaa12a = new Jcaa12a();
                jcaa12a.setJcaa12a030(monitorCode);
                jcaa12a.setJcca31b180(sensorCode);
                jcaa12a.setJcaa12a040(time);
                jcaa12a.setJcaa12a050(dipAngle.toString());
                resultX.add(jcaa12a);
            });
        });
        return resultX;
    }

    /**
     * 气温月统计辅助方法
     * @param list
     * @param monitorCode
     * @return
     */
    public static List<Jcaa12a> getDetectionCurveAirTemperatureMonthMethod(List<Jcaa12a> list, String monitorCode) {
        // 日期格式化只保留年月
        list = list.stream()
                .map(dc -> {
                    dc.setJcaa12a040(dc.getJcaa12a040().substring(0, 7));
                    return dc;
                })
                .collect(Collectors.toList());
        // 根据SensorCode和DateTime进行分组并对AirTemperature求平均值
//        Map<String, Map<String, Double>> airTemperatureAvgMap = list.stream()
//                .collect(
//                        Collectors.groupingBy(Jcaa12a::getJcca31b180,
//                                Collectors.groupingBy(dc -> dc.getJcaa12a040().substring(0, 7),
//                                        Collectors.averagingDouble(dc -> Double.parseDouble(dc.getJcaa12a050())))));
        Map<String, Map<String, Double>> airTemperatureAvgMap = list.stream()
                .collect(
                        Collectors.groupingBy(Jcaa12a::getJcca31b180,
                                Collectors.toMap(dc -> dc.getJcaa12a040().substring(0, 7),
                                        dc -> Double.parseDouble(dc.getJcaa12a050()),
                                        (oldValue, newValue) -> oldValue,
                                        LinkedHashMap::new)
                        )
                );

        // 将Map<String, Map<String, Double>> dipAngleAvgMap转化为List<DetectionCurveVo>
        // key -> sensorCode, value map key -> dateTime,value map value -> dipAngle
        List<Jcaa12a> resultX = new ArrayList<>();
        airTemperatureAvgMap.forEach((sensorCode, timeDipAngleMap) -> {
            timeDipAngleMap.forEach((time, dipAngle) -> {
                Jcaa12a jcaa12a = new Jcaa12a();
                jcaa12a.setJcaa12a030(monitorCode);
                jcaa12a.setJcca31b180(sensorCode);
                jcaa12a.setJcaa12a040(time);
                jcaa12a.setJcaa12a050(dipAngle.toString());
                resultX.add(jcaa12a);
            });
        });
        return resultX;
    }

    /**
     * 裂缝日统计辅助方法
     * @param crackCollectionValueList
     * @param monitorCode
     * @return
     */
    public static List<DetectionCurveCrackVo> getDetectionCurveCrackDayMethod(List<DetectionCurveCrackVo> crackCollectionValueList, String monitorCode) {
        // 日期格式化只保留年月日
        crackCollectionValueList = crackCollectionValueList.stream()
                .map(dc -> {
                    dc.setDateTime(dc.getDateTime().substring(0, 10));
                    return dc;
                })
                .collect(Collectors.toList());
        // 根据SensorCode和DateTime进行分组并对Acceleration求平均值并按时间升序排列
        Map<String, Map<String, Double>> accelerationAvgMap = crackCollectionValueList.stream()
                .collect(
                        Collectors.groupingBy(DetectionCurveCrackVo::getSensorCode,
                                Collectors.toMap(dc -> dc.getDateTime().substring(0, 10),
                                        dc -> Double.parseDouble(dc.getValue()),
                                        (oldValue, newValue) -> oldValue,
                                        LinkedHashMap::new)
                        )
                );

        // 将Map<String, Map<String, Double>> accelerationAvgMap转化为List<DetectionCurveVo>
        // key -> sensorCode, value map key -> dateTime,value map value -> acceleration
        List<DetectionCurveCrackVo> resultX = new ArrayList<>();
        accelerationAvgMap.forEach((sensorCode, timeAccelerationMap) -> {
            timeAccelerationMap.forEach((time, acceleration) -> {
                DetectionCurveCrackVo detectionCurveVo = new DetectionCurveCrackVo();
                detectionCurveVo.setMonitorCode(monitorCode);
                detectionCurveVo.setSensorCode(sensorCode);
                detectionCurveVo.setDateTime(time);
                detectionCurveVo.setValue(acceleration.toString());
                resultX.add(detectionCurveVo);
            });
        });
        return resultX;
    }

    /**
     * 裂缝月统计辅助方法
     * @param crackCollectionValueList
     * @param monitorCode
     * @return
     */
    public static List<DetectionCurveCrackVo> getDetectionCurveCrackMonthMethod(List<DetectionCurveCrackVo> crackCollectionValueList, String monitorCode) {
        // 日期格式化只保留年月
        crackCollectionValueList = crackCollectionValueList.stream()
                .map(dc -> {
                    dc.setDateTime(dc.getDateTime().substring(0, 7));
                    return dc;
                })
                .collect(Collectors.toList());
        // 根据SensorCode和DateTime进行分组并对Acceleration求平均值并按时间升序排列
        Map<String, Map<String, Double>> accelerationAvgMap = crackCollectionValueList.stream()
                .collect(
                        Collectors.groupingBy(DetectionCurveCrackVo::getSensorCode,
                                Collectors.toMap(dc -> dc.getDateTime().substring(0, 10),
                                        dc -> Double.parseDouble(dc.getValue()),
                                        (oldValue, newValue) -> oldValue,
                                        LinkedHashMap::new)
                        )
                );
        // 将Map<String, Map<String, Double>> accelerationAvgMap转化为List<DetectionCurveVo>
        // key -> sensorCode, value map key -> dateTime,value map value -> acceleration
        List<DetectionCurveCrackVo> resultX = new ArrayList<>();
        accelerationAvgMap.forEach((sensorCode, timeAccelerationMap) -> {
            timeAccelerationMap.forEach((time, acceleration) -> {
                DetectionCurveCrackVo detectionCurveVo = new DetectionCurveCrackVo();
                detectionCurveVo.setMonitorCode(monitorCode);
                detectionCurveVo.setSensorCode(sensorCode);
                detectionCurveVo.setDateTime(time);
                detectionCurveVo.setValue(acceleration.toString());
                resultX.add(detectionCurveVo);
            });
        });
        return resultX;
    }


    /**
     * 土壤含水率日统计辅助方法
     * @param list
     * @return
     */
    public static List<Jcaa14a> getDetectionCurveSoilMoistureContentDayMethod(List<Jcaa14a> list,String monitorCode) {
        // 日期格式化只保留年月日
        list = list.stream()
                .map(dc -> {
                    dc.setJcaa14a040(dc.getJcaa14a040().substring(0, 10));
                    return dc;
                })
                .collect(Collectors.toList());
        // 根据SensorCode和DateTime进行分组并对Acceleration求平均值并按时间升序排列
        Map<String, Map<String, Double>> accelerationAvgMap = list.stream()
                .collect(
                        Collectors.groupingBy(Jcaa14a::getJcca31b180,
                                Collectors.toMap(dc -> dc.getJcaa14a040().substring(0, 10),
                                        dc -> Double.parseDouble(dc.getJcaa14a050()),
                                        (oldValue, newValue) -> oldValue,
                                        LinkedHashMap::new)
                        )
                );

        // 将Map<String, Map<String, Double>> accelerationAvgMap转化为List<DetectionCurveVo>
        // key -> sensorCode, value map key -> dateTime,value map value -> acceleration
        List<Jcaa14a> resultX = new ArrayList<>();
        accelerationAvgMap.forEach((sensorCode, timeAccelerationMap) -> {
            timeAccelerationMap.forEach((time, acceleration) -> {
                Jcaa14a jcaa14a = new Jcaa14a();
                jcaa14a.setJcaa14a030(monitorCode);
                jcaa14a.setJcca31b180(sensorCode);
                jcaa14a.setJcaa14a040(time);
                jcaa14a.setJcaa14a050(acceleration.toString());
                resultX.add(jcaa14a);
            });
        });
        return resultX;
    }

    /**
     * 土壤含水率月统计辅助方法
     * @param list
     * @return
     */
    public static List<Jcaa14a> getDetectionCurveSoilMoistureContentMonthMethod(List<Jcaa14a> list, String monitorCode) {
        // 日期格式化只保留年月日
        list = list.stream()
                .map(dc -> {
                    dc.setJcaa14a040(dc.getJcaa14a040().substring(0, 7));
                    return dc;
                })
                .collect(Collectors.toList());
        // 根据SensorCode和DateTime进行分组并对Acceleration求平均值并按时间升序排列
        Map<String, Map<String, Double>> accelerationAvgMap = list.stream()
                .collect(
                        Collectors.groupingBy(Jcaa14a::getJcca31b180,
                                Collectors.toMap(dc -> dc.getJcaa14a040().substring(0, 7),
                                        dc -> Double.parseDouble(dc.getJcaa14a050()),
                                        (oldValue, newValue) -> oldValue,
                                        LinkedHashMap::new)
                        )
                );

        // 将Map<String, Map<String, Double>> accelerationAvgMap转化为List<DetectionCurveVo>
        // key -> sensorCode, value map key -> dateTime,value map value -> acceleration
        List<Jcaa14a> resultX = new ArrayList<>();
        accelerationAvgMap.forEach((sensorCode, timeAccelerationMap) -> {
            timeAccelerationMap.forEach((time, acceleration) -> {
                Jcaa14a jcaa14a = new Jcaa14a();
                jcaa14a.setJcaa14a030(monitorCode);
                jcaa14a.setJcca31b180(sensorCode);
                jcaa14a.setJcaa14a040(time);
                jcaa14a.setJcaa14a050(acceleration.toString());
                resultX.add(jcaa14a);
            });
        });
        return resultX;
    }

    /**
     * 泥水位日统计辅助方法
     * @param list
     * @return
     */
    public static List<Jcaa22a> getDetectionCurveMudWaterLevelDayMethod(List<Jcaa22a> list, String monitorCode) {
        // 日期格式化只保留年月日
        list = list.stream()
                .map(dc -> {
                    dc.setJcaa22a040(dc.getJcaa22a040().substring(0, 10));
                    return dc;
                })
                .collect(Collectors.toList());
        // 根据SensorCode和DateTime进行分组并对Acceleration求平均值并按时间升序排列
        Map<String, Map<String, Double>> accelerationAvgMap = list.stream()
                .collect(
                        Collectors.groupingBy(Jcaa22a::getJcca31b180,
                                Collectors.toMap(dc -> dc.getJcaa22a040().substring(0, 10),
                                        dc -> Double.parseDouble(dc.getJcaa22a050()),
                                        (oldValue, newValue) -> oldValue,
                                        LinkedHashMap::new)
                        )
                );

        // 将Map<String, Map<String, Double>> accelerationAvgMap转化为List<DetectionCurveVo>
        // key -> sensorCode, value map key -> dateTime,value map value -> acceleration
        List<Jcaa22a> resultX = new ArrayList<>();
        accelerationAvgMap.forEach((sensorCode, timeAccelerationMap) -> {
            timeAccelerationMap.forEach((time, acceleration) -> {
                Jcaa22a jcaa22a = new Jcaa22a();
                jcaa22a.setJcca31b030(monitorCode);
                jcaa22a.setJcca31b180(sensorCode);
                jcaa22a.setJcaa22a040(time);
                jcaa22a.setJcaa22a050(acceleration.toString());
                resultX.add(jcaa22a);
            });
        });
        return resultX;
    }

    /**
     * 泥水位月统计辅助方法
     * @param list
     * @param monitorCode
     * @return
     */
    public static List<Jcaa22a> getDetectionCurveMudWaterLevelMonthMethod(List<Jcaa22a> list, String monitorCode) {
        // 日期格式化只保留年月日
        list = list.stream()
                .map(dc -> {
                    dc.setJcaa22a040(dc.getJcaa22a040().substring(0, 7));
                    return dc;
                })
                .collect(Collectors.toList());
        // 根据SensorCode和DateTime进行分组并对Acceleration求平均值并按时间升序排列
        Map<String, Map<String, Double>> accelerationAvgMap = list.stream()
                .collect(
                        Collectors.groupingBy(Jcaa22a::getJcca31b180,
                                Collectors.toMap(dc -> dc.getJcaa22a040().substring(0, 7),
                                        dc -> Double.parseDouble(dc.getJcaa22a050()),
                                        (oldValue, newValue) -> oldValue,
                                        LinkedHashMap::new)
                        )
                );

        // 将Map<String, Map<String, Double>> accelerationAvgMap转化为List<DetectionCurveVo>
        // key -> sensorCode, value map key -> dateTime,value map value -> acceleration
        List<Jcaa22a> resultX = new ArrayList<>();
        accelerationAvgMap.forEach((sensorCode, timeAccelerationMap) -> {
            timeAccelerationMap.forEach((time, acceleration) -> {
                Jcaa22a jcaa22a = new Jcaa22a();
                jcaa22a.setJcca31b030(monitorCode);
                jcaa22a.setJcca31b180(sensorCode);
                jcaa22a.setJcaa22a040(time);
                jcaa22a.setJcaa22a050(acceleration.toString());
                resultX.add(jcaa22a);
            });
        });
        return resultX;
    }

    /**
     * 气压日统计辅助方法
     * @param list
     * @param monitorCode
     * @return
     */
    public static List<Jcaa21a> getDetectionCurvePressureDayMethod(List<Jcaa21a> list, String monitorCode) {
      // 日期格式化只保留年月日
        list = list.stream()
                .map(dc -> {
                    dc.setJcaa21a040(dc.getJcaa21a040().substring(0, 10));
                    return dc;
                })
                .collect(Collectors.toList());
        // 根据SensorCode和DateTime进行分组并对气压求平均值并按时间升序排列
        Map<String, Map<String, Double>> accelerationAvgMap = list.stream()
                .collect(
                        Collectors.groupingBy(Jcaa21a::getJcca31b180,
                                Collectors.toMap(dc -> dc.getJcaa21a040().substring(0, 10),
                                        dc -> Double.parseDouble(dc.getJcaa21a050()),
                                        (oldValue, newValue) -> oldValue,
                                        LinkedHashMap::new)
                        )
                );

        // 将Map<String, Map<String, Double>> accelerationAvgMap转化为List<DetectionCurveVo>
        // key -> sensorCode, value map key -> dateTime,value map value -> acceleration
        List<Jcaa21a> resultX = new ArrayList<>();
        accelerationAvgMap.forEach((sensorCode, timeAccelerationMap) -> {
            timeAccelerationMap.forEach((time, acceleration) -> {
                Jcaa21a jcaa21a = new Jcaa21a();
                jcaa21a.setJcca31b030(monitorCode);
                jcaa21a.setJcca31b180(sensorCode);
                jcaa21a.setJcaa21a040(time);
                jcaa21a.setJcaa21a050(acceleration.toString());
                resultX.add(jcaa21a);
            });
        });
        return resultX;
    }


    /**
     * 气压月统计辅助方法
     * @param list
     * @param monitorCode
     * @return
     */
    public static List<Jcaa21a> getDetectionCurvePressureMonthMethod(List<Jcaa21a> list, String monitorCode) {
        // 日期格式化只保留年月
        list = list.stream()
                .map(dc -> {
                    dc.setJcaa21a040(dc.getJcaa21a040().substring(0, 7));
                    return dc;
                })
                .collect(Collectors.toList());
        // 根据SensorCode和DateTime进行分组并对气压求平均值并按时间升序排列
        Map<String, Map<String, Double>> accelerationAvgMap = list.stream()
                .collect(
                        Collectors.groupingBy(Jcaa21a::getJcca31b180,
                                Collectors.toMap(dc -> dc.getJcaa21a040().substring(0, 7),
                                        dc -> Double.parseDouble(dc.getJcaa21a050()),
                                        (oldValue, newValue) -> oldValue,
                                        LinkedHashMap::new)
                        )
                );

        // 将Map<String, Map<String, Double>> accelerationAvgMap转化为List<DetectionCurveVo>
        // key -> sensorCode, value map key -> dateTime,value map value -> acceleration
        List<Jcaa21a> resultX = new ArrayList<>();
        accelerationAvgMap.forEach((sensorCode, timeAccelerationMap) -> {
            timeAccelerationMap.forEach((time, acceleration) -> {
                Jcaa21a jcaa21a = new Jcaa21a();
                jcaa21a.setJcca31b030(monitorCode);
                jcaa21a.setJcca31b180(sensorCode);
                jcaa21a.setJcaa21a040(time);
                jcaa21a.setJcaa21a050(acceleration.toString());
                resultX.add(jcaa21a);
            });
        });
        return resultX;
    }

    /**
     * 振动日统计辅助方法
     * @param list
     * @param monitorCode
     * @return
     */
    public static List<DetectionCurveCrackVo> getDetectionCurveVibrateDayMethod(List<DetectionCurveCrackVo> list, String monitorCode) {
        // 日期格式化只保留年月日
        list = list.stream()
                .map(dc -> {
                    dc.setDateTime(dc.getDateTime().substring(0, 10));
                    return dc;
                })
                .collect(Collectors.toList());
        // 根据SensorCode和DateTime进行分组并对求平均值并按时间升序排列
        Map<String, Map<String, Double>> accelerationAvgMap = list.stream()
                .collect(
                        Collectors.groupingBy(DetectionCurveCrackVo::getSensorCode,
                                Collectors.toMap(dc -> dc.getDateTime().substring(0, 10),
                                        dc -> Double.parseDouble(dc.getValue()),
                                        (oldValue, newValue) -> oldValue,
                                        LinkedHashMap::new)
                        )
                );

        // 将Map<String, Map<String, Double>> accelerationAvgMap转化为List<DetectionCurveVo>
        // key -> sensorCode, value map key -> dateTime,value map value -> acceleration
        List<DetectionCurveCrackVo> resultX = new ArrayList<>();
        accelerationAvgMap.forEach((sensorCode, timeAccelerationMap) -> {
            timeAccelerationMap.forEach((time, acceleration) -> {
                DetectionCurveCrackVo detectionCurveCrackVo = new DetectionCurveCrackVo();
                detectionCurveCrackVo.setMonitorCode(monitorCode);
                detectionCurveCrackVo.setSensorCode(sensorCode);
                detectionCurveCrackVo.setDateTime(time);
                detectionCurveCrackVo.setValue(acceleration.toString());
                resultX.add(detectionCurveCrackVo);
            });
        });
        return resultX;
    }

    /**
     * 振动月统计辅助方法
     * @param list
     * @param monitorCode
     * @return
     */
    public static List<DetectionCurveCrackVo> getDetectionCurveVibrateMonthMethod(List<DetectionCurveCrackVo> list, String monitorCode) {
        // 日期格式化只保留年月日
        list = list.stream()
                .map(dc -> {
                    dc.setDateTime(dc.getDateTime().substring(0, 7));
                    return dc;
                })
                .collect(Collectors.toList());
        // 根据SensorCode和DateTime进行分组并对求平均值并按时间升序排列
        Map<String, Map<String, Double>> accelerationAvgMap = list.stream()
                .collect(
                        Collectors.groupingBy(DetectionCurveCrackVo::getSensorCode,
                                Collectors.toMap(dc -> dc.getDateTime().substring(0, 7),
                                        dc -> Double.parseDouble(dc.getValue()),
                                        (oldValue, newValue) -> oldValue,
                                        LinkedHashMap::new)
                        )
                );

        // 将Map<String, Map<String, Double>> accelerationAvgMap转化为List<DetectionCurveVo>
        // key -> sensorCode, value map key -> dateTime,value map value -> acceleration
        List<DetectionCurveCrackVo> resultX = new ArrayList<>();
        accelerationAvgMap.forEach((sensorCode, timeAccelerationMap) -> {
            timeAccelerationMap.forEach((time, acceleration) -> {
                DetectionCurveCrackVo detectionCurveCrackVo = new DetectionCurveCrackVo();
                detectionCurveCrackVo.setMonitorCode(monitorCode);
                detectionCurveCrackVo.setSensorCode(sensorCode);
                detectionCurveCrackVo.setDateTime(time);
                detectionCurveCrackVo.setValue(acceleration.toString());
                resultX.add(detectionCurveCrackVo);
            });
        });
        return resultX;
    }

    /**
     * 深度位移日统计辅助方法
     * @param list
     * @param monitorCode
     * @return
     */
    public static List<DetectionCurveDeepDisplacementVo> getDetectionCurveDeepDisplacementDayMethod(List<DetectionCurveDeepDisplacementVo> list, String monitorCode) {
        // 日期格式化只保留年月日
        list = list.stream()
                .map(dc -> {
                    dc.setDateTime(dc.getDateTime().substring(0, 10));
                    return dc;
                })
                .collect(Collectors.toList());
        // 根据SensorCode和DateTime进行分组并对求平均值并按时间升序排列
        Map<String, Map<String, Double>> accelerationAvgMap = list.stream()
                .collect(
                        Collectors.groupingBy(DetectionCurveDeepDisplacementVo::getSensorCode,
                                Collectors.toMap(dc -> dc.getDateTime().substring(0, 10),
                                        dc -> Double.parseDouble(dc.getValue()),
                                        (oldValue, newValue) -> oldValue,
                                        LinkedHashMap::new)
                        )
                );

        // 将Map<String, Map<String, Double>> accelerationAvgMap转化为List<DetectionCurveVo>
        // key -> sensorCode, value map key -> dateTime,value map value -> acceleration
        List<DetectionCurveDeepDisplacementVo> resultX = new ArrayList<>();
        accelerationAvgMap.forEach((sensorCode, timeAccelerationMap) -> {
            timeAccelerationMap.forEach((time, acceleration) -> {
                DetectionCurveDeepDisplacementVo detectionCurveDeepDisplacementVo = new DetectionCurveDeepDisplacementVo();
                detectionCurveDeepDisplacementVo.setMonitorCode(monitorCode);
                detectionCurveDeepDisplacementVo.setSensorCode(sensorCode);
                detectionCurveDeepDisplacementVo.setDateTime(time);
                detectionCurveDeepDisplacementVo.setValue(acceleration.toString());
                resultX.add(detectionCurveDeepDisplacementVo);
            });
        });
        return resultX;
    }

    /**
     * 深度位移月统计辅助方法
     * @param list
     * @param monitorCode
     * @return
     */
    public static List<DetectionCurveDeepDisplacementVo> getDetectionCurveDeepDisplacementMonthMethod(List<DetectionCurveDeepDisplacementVo> list, String monitorCode) {
        // 日期格式化只保留年月
        list = list.stream()
                .map(dc -> {
                    dc.setDateTime(dc.getDateTime().substring(0, 7));
                    return dc;
                })
                .collect(Collectors.toList());
        // 根据SensorCode和DateTime进行分组并对求平均值并按时间升序排列
        Map<String, Map<String, Double>> accelerationAvgMap = list.stream()
                .collect(
                        Collectors.groupingBy(DetectionCurveDeepDisplacementVo::getSensorCode,
                                Collectors.toMap(dc -> dc.getDateTime().substring(0, 7),
                                        dc -> Double.parseDouble(dc.getValue()),
                                        (oldValue, newValue) -> oldValue,
                                        LinkedHashMap::new)
                        )
                );

        // 将Map<String, Map<String, Double>> accelerationAvgMap转化为List<DetectionCurveVo>
        // key -> sensorCode, value map key -> dateTime,value map value -> acceleration
        List<DetectionCurveDeepDisplacementVo> resultX = new ArrayList<>();
        accelerationAvgMap.forEach((sensorCode, timeAccelerationMap) -> {
            timeAccelerationMap.forEach((time, acceleration) -> {
                DetectionCurveDeepDisplacementVo detectionCurveDeepDisplacementVo = new DetectionCurveDeepDisplacementVo();
                detectionCurveDeepDisplacementVo.setMonitorCode(monitorCode);
                detectionCurveDeepDisplacementVo.setSensorCode(sensorCode);
                detectionCurveDeepDisplacementVo.setDateTime(time);
                detectionCurveDeepDisplacementVo.setValue(acceleration.toString());
                resultX.add(detectionCurveDeepDisplacementVo);
            });
        });
        return resultX;
    }


    /**
     * 土压力日统计辅助方法
     * @param list
     * @param monitorCode
     * @return
     */
    public static List<Jcaa08a> getDetectionCurveSoilPressureDayMethod(List<Jcaa08a> list, String monitorCode) {
        // 日期格式化只保留年月
        list = list.stream()
                .map(dc -> {
                    dc.setJcaa08a040(dc.getJcaa08a040().substring(0, 10));
                    return dc;
                })
                .collect(Collectors.toList());
        // 根据SensorCode和DateTime进行分组并对求平均值并按时间升序排列
        Map<String, Map<String, Double>> accelerationAvgMap = list.stream()
                .collect(
                        Collectors.groupingBy(Jcaa08a::getJcca31b180,
                                Collectors.toMap(dc -> dc.getJcaa08a040().substring(0, 10),
                                        dc -> Double.parseDouble(dc.getJcaa08a050()),
                                        (oldValue, newValue) -> oldValue,
                                        LinkedHashMap::new)
                        )
                );

        // 将Map<String, Map<String, Double>> accelerationAvgMap转化为List<DetectionCurveVo>
        // key -> sensorCode, value map key -> dateTime,value map value -> acceleration
        List<Jcaa08a> resultX = new ArrayList<>();
        accelerationAvgMap.forEach((sensorCode, timeAccelerationMap) -> {
            timeAccelerationMap.forEach((time, acceleration) -> {
                Jcaa08a jcaa08a = new Jcaa08a();
                jcaa08a.setJcca31b030(monitorCode);
                jcaa08a.setJcca31b180(sensorCode);
                jcaa08a.setJcaa08a040(time);
                jcaa08a.setJcaa08a050(acceleration.toString());
                resultX.add(jcaa08a);
            });
        });
        return resultX;
    }

    /**
     * 土压力月统计辅助方法
     * @param list
     * @param monitorCode
     * @return
     */
    public static List<Jcaa08a> getDetectionCurveSoilPressureMonthMethod(List<Jcaa08a> list, String monitorCode) {
        // 日期格式化只保留年月
        list = list.stream()
                .map(dc -> {
                    dc.setJcaa08a040(dc.getJcaa08a040().substring(0, 7));
                    return dc;
                })
                .collect(Collectors.toList());
        // 根据SensorCode和DateTime进行分组并对求平均值并按时间升序排列
        Map<String, Map<String, Double>> accelerationAvgMap = list.stream()
                .collect(
                        Collectors.groupingBy(Jcaa08a::getJcca31b180,
                                Collectors.toMap(dc -> dc.getJcaa08a040().substring(0, 7),
                                        dc -> Double.parseDouble(dc.getJcaa08a050()),
                                        (oldValue, newValue) -> oldValue,
                                        LinkedHashMap::new)
                        )
                );

        // 将Map<String, Map<String, Double>> accelerationAvgMap转化为List<DetectionCurveVo>
        // key -> sensorCode, value map key -> dateTime,value map value -> acceleration
        List<Jcaa08a> resultX = new ArrayList<>();
        accelerationAvgMap.forEach((sensorCode, timeAccelerationMap) -> {
            timeAccelerationMap.forEach((time, acceleration) -> {
                Jcaa08a jcaa08a = new Jcaa08a();
                jcaa08a.setJcca31b030(monitorCode);
                jcaa08a.setJcca31b180(sensorCode);
                jcaa08a.setJcaa08a040(time);
                jcaa08a.setJcaa08a050(acceleration.toString());
                resultX.add(jcaa08a);
            });
        });
        return resultX;
    }

    /**
     * 土壤温度日辅助方法
     * @param list
     * @param monitorCode
     * @return
     */
    public static List<Jcaa13a> getDetectionCurveSoilTemperaDayMethod(List<Jcaa13a> list, String monitorCode) {
        // 日期格式化只保留年月
        list = list.stream()
                .map(dc -> {
                    dc.setJcaa13a040(dc.getJcaa13a040().substring(0, 10));
                    return dc;
                })
                .collect(Collectors.toList());
        // 根据SensorCode和DateTime进行分组并对求平均值并按时间升序排列
        Map<String, Map<String, Double>> accelerationAvgMap = list.stream()
                .collect(
                        Collectors.groupingBy(Jcaa13a::getJcca31b180,
                                Collectors.toMap(dc -> dc.getJcaa13a040().substring(0, 10),
                                        dc -> Double.parseDouble(dc.getJcaa13a050()),
                                        (oldValue, newValue) -> oldValue,
                                        LinkedHashMap::new)
                        )
                );

        // 将Map<String, Map<String, Double>> accelerationAvgMap转化为List<DetectionCurveVo>
        // key -> sensorCode, value map key -> dateTime,value map value -> acceleration
        List<Jcaa13a> resultX = new ArrayList<>();
        accelerationAvgMap.forEach((sensorCode, timeAccelerationMap) -> {
            timeAccelerationMap.forEach((time, acceleration) -> {
                Jcaa13a jcaa13a = new Jcaa13a();
                jcaa13a.setJcca31b030(monitorCode);
                jcaa13a.setJcca31b180(sensorCode);
                jcaa13a.setJcaa13a040(time);
                jcaa13a.setJcaa13a050(acceleration.toString());
                resultX.add(jcaa13a);
            });
        });
        return resultX;
    }

    public static List<Jcaa13a> getDetectionCurveSoilTemperaMonthMethod(List<Jcaa13a> list, String monitorCode) {
        // 日期格式化只保留年月
        list = list.stream()
                .map(dc -> {
                    dc.setJcaa13a040(dc.getJcaa13a040().substring(0,7));
                    return dc;
                })
                .collect(Collectors.toList());
        // 根据SensorCode和DateTime进行分组并对求平均值并按时间升序排列
        Map<String, Map<String, Double>> accelerationAvgMap = list.stream()
                .collect(
                        Collectors.groupingBy(Jcaa13a::getJcca31b180,
                                Collectors.toMap(dc -> dc.getJcaa13a040().substring(0, 7),
                                        dc -> Double.parseDouble(dc.getJcaa13a050()),
                                        (oldValue, newValue) -> oldValue,
                                        LinkedHashMap::new)
                        )
                );

        // 将Map<String, Map<String, Double>> accelerationAvgMap转化为List<DetectionCurveVo>
        // key -> sensorCode, value map key -> dateTime,value map value -> acceleration
        List<Jcaa13a> resultX = new ArrayList<>();
        accelerationAvgMap.forEach((sensorCode, timeAccelerationMap) -> {
            timeAccelerationMap.forEach((time, acceleration) -> {
                Jcaa13a jcaa13a = new Jcaa13a();
                jcaa13a.setJcca31b030(monitorCode);
                jcaa13a.setJcca31b180(sensorCode);
                jcaa13a.setJcaa13a040(time);
                jcaa13a.setJcaa13a050(acceleration.toString());
                resultX.add(jcaa13a);
            });
        });
        return resultX;
    }

    /**
     * 地下水位水温日辅助方法
     * @param list
     * @param monitorCode
     * @return
     */
    public static List<DetectionCurveUndergroundWaterLevelTemperaVo> getDetectionCurveUndergroundWaterLevelTemperaDayMethod(
            List<DetectionCurveUndergroundWaterLevelTemperaVo> list, String monitorCode) {
        // 日期格式化只保留年月日
        list = list.stream()
                .map(dc -> {
                    dc.setDateTime(dc.getDateTime().substring(0, 10));
                    return dc;
                })
                .collect(Collectors.toList());
        // 根据SensorCode和DateTime进行分组并对求平均值并按时间升序排列
        Map<String, Map<String, Double>> accelerationAvgMap = list.stream()
                .collect(
                        Collectors.groupingBy(DetectionCurveUndergroundWaterLevelTemperaVo::getSensorCode,
                                Collectors.toMap(dc -> dc.getDateTime().substring(0, 10),
                                        dc -> Double.parseDouble(dc.getValue()),
                                        (oldValue, newValue) -> oldValue,
                                        LinkedHashMap::new)
                        )
                );

        // 将Map<String, Map<String, Double>> accelerationAvgMap转化为List<DetectionCurveVo>
        // key -> sensorCode, value map key -> dateTime,value map value -> acceleration
        List<DetectionCurveUndergroundWaterLevelTemperaVo> resultX = new ArrayList<>();
        accelerationAvgMap.forEach((sensorCode, timeAccelerationMap) -> {
            timeAccelerationMap.forEach((time, acceleration) -> {
                DetectionCurveUndergroundWaterLevelTemperaVo detectionCurveUndergroundWaterLevelTemperaVo = new DetectionCurveUndergroundWaterLevelTemperaVo();
                detectionCurveUndergroundWaterLevelTemperaVo.setMonitorCode(monitorCode);
                detectionCurveUndergroundWaterLevelTemperaVo.setSensorCode(sensorCode);
                detectionCurveUndergroundWaterLevelTemperaVo.setDateTime(time);
                detectionCurveUndergroundWaterLevelTemperaVo.setValue(acceleration.toString());
                resultX.add(detectionCurveUndergroundWaterLevelTemperaVo);
            });
        });
        return resultX;
    }

    /**
     * 地下水位水温月辅助方法
     * @param list
     * @param monitorCode
     * @return
     */
    public static List<DetectionCurveUndergroundWaterLevelTemperaVo> getDetectionCurveUndergroundWaterLevelTemperaMonthMethod(
            List<DetectionCurveUndergroundWaterLevelTemperaVo> list, String monitorCode) {
        // 日期格式化只保留年月日
        list = list.stream()
                .map(dc -> {
                    dc.setDateTime(dc.getDateTime().substring(0, 7));
                    return dc;
                })
                .collect(Collectors.toList());
        // 根据SensorCode和DateTime进行分组并对求平均值并按时间升序排列
        Map<String, Map<String, Double>> accelerationAvgMap = list.stream()
                .collect(
                        Collectors.groupingBy(DetectionCurveUndergroundWaterLevelTemperaVo::getSensorCode,
                                Collectors.toMap(dc -> dc.getDateTime().substring(0, 7),
                                        dc -> Double.parseDouble(dc.getValue()),
                                        (oldValue, newValue) -> oldValue,
                                        LinkedHashMap::new)
                        )
                );

        // 将Map<String, Map<String, Double>> accelerationAvgMap转化为List<DetectionCurveVo>
        // key -> sensorCode, value map key -> dateTime,value map value -> acceleration
        List<DetectionCurveUndergroundWaterLevelTemperaVo> resultX = new ArrayList<>();
        accelerationAvgMap.forEach((sensorCode, timeAccelerationMap) -> {
            timeAccelerationMap.forEach((time, acceleration) -> {
                DetectionCurveUndergroundWaterLevelTemperaVo detectionCurveUndergroundWaterLevelTemperaVo = new DetectionCurveUndergroundWaterLevelTemperaVo();
                detectionCurveUndergroundWaterLevelTemperaVo.setMonitorCode(monitorCode);
                detectionCurveUndergroundWaterLevelTemperaVo.setSensorCode(sensorCode);
                detectionCurveUndergroundWaterLevelTemperaVo.setDateTime(time);
                detectionCurveUndergroundWaterLevelTemperaVo.setValue(acceleration.toString());
                resultX.add(detectionCurveUndergroundWaterLevelTemperaVo);
            });
        });
        return resultX;
    }

    /**
     * 孔隙水压力日辅助方法
     * @param temperatureList
     * @param monitorCode
     * @return
     */
    public static List<DetectionCurvePoreWaterPressureVo> getDetectionCurvePoreWaterPressureDayMethod(
            List<DetectionCurvePoreWaterPressureVo> list, String monitorCode) {
        // 日期格式化只保留年月日
        list = list.stream()
                .map(dc -> {
                    dc.setDateTime(dc.getDateTime().substring(0, 10));
                    return dc;
                })
                .collect(Collectors.toList());
        // 根据SensorCode和DateTime进行分组并对求平均值并按时间升序排列
        Map<String, Map<String, Double>> accelerationAvgMap = list.stream()
                .collect(
                        Collectors.groupingBy(DetectionCurvePoreWaterPressureVo::getSensorCode,
                                Collectors.toMap(dc -> dc.getDateTime().substring(0, 10),
                                        dc -> Double.parseDouble(dc.getValue()),
                                        (oldValue, newValue) -> oldValue,
                                        LinkedHashMap::new)
                        )
                );

        // 将Map<String, Map<String, Double>> accelerationAvgMap转化为List<DetectionCurveVo>
        // key -> sensorCode, value map key -> dateTime,value map value -> acceleration
        List<DetectionCurvePoreWaterPressureVo> resultX = new ArrayList<>();
        accelerationAvgMap.forEach((sensorCode, timeAccelerationMap) -> {
            timeAccelerationMap.forEach((time, acceleration) -> {
                DetectionCurvePoreWaterPressureVo detectionCurvePoreWaterPressureVo = new DetectionCurvePoreWaterPressureVo();
                detectionCurvePoreWaterPressureVo.setMonitorCode(monitorCode);
                detectionCurvePoreWaterPressureVo.setSensorCode(sensorCode);
                detectionCurvePoreWaterPressureVo.setDateTime(time);
                detectionCurvePoreWaterPressureVo.setValue(acceleration.toString());
                resultX.add(detectionCurvePoreWaterPressureVo);
            });
        });
        return resultX;

    }

    /**
     * 孔隙水压力月辅助方法
     * @param temperatureList
     * @param monitorCode
     * @return
     */
    public static List<DetectionCurvePoreWaterPressureVo> getDetectionCurvePoreWaterPressureMonthMethod(
            List<DetectionCurvePoreWaterPressureVo> list, String monitorCode) {
        // 日期格式化只保留年月日
        list = list.stream()
                .map(dc -> {
                    dc.setDateTime(dc.getDateTime().substring(0, 7));
                    return dc;
                })
                .collect(Collectors.toList());
        // 根据SensorCode和DateTime进行分组并对求平均值并按时间升序排列
        Map<String, Map<String, Double>> accelerationAvgMap = list.stream()
                .collect(
                        Collectors.groupingBy(DetectionCurvePoreWaterPressureVo::getSensorCode,
                                Collectors.toMap(dc -> dc.getDateTime().substring(0, 7),
                                        dc -> Double.parseDouble(dc.getValue()),
                                        (oldValue, newValue) -> oldValue,
                                        LinkedHashMap::new)
                        )
                );

        // 将Map<String, Map<String, Double>> accelerationAvgMap转化为List<DetectionCurveVo>
        // key -> sensorCode, value map key -> dateTime,value map value -> acceleration
        List<DetectionCurvePoreWaterPressureVo> resultX = new ArrayList<>();
        accelerationAvgMap.forEach((sensorCode, timeAccelerationMap) -> {
            timeAccelerationMap.forEach((time, acceleration) -> {
                DetectionCurvePoreWaterPressureVo detectionCurvePoreWaterPressureVo = new DetectionCurvePoreWaterPressureVo();
                detectionCurvePoreWaterPressureVo.setMonitorCode(monitorCode);
                detectionCurvePoreWaterPressureVo.setSensorCode(sensorCode);
                detectionCurvePoreWaterPressureVo.setDateTime(time);
                detectionCurvePoreWaterPressureVo.setValue(acceleration.toString());
                resultX.add(detectionCurvePoreWaterPressureVo);
            });
        });
        return resultX;
    }
}


